import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'
import Graduates from '../views/Graduates.vue'
import Employment from '../views/Employment.vue'
import Archives from '../views/Archives.vue'
import Home from "../components/Home";
import GraDesign from "../views/GraDesign";
import Grades from "../views/Grades";

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'index',
        redirect: {name: "Login"}
    },
    {
        path: '/login',
        name: 'Login',
        component: Login
    },
    {
        path: '/home',
        name: 'Home',
        meta: {title: '主页', requireAuth: true},
        component: Home,
        children: [
            {
                path: '/graduates',
                name: 'Graduates',
                meta: {
                    title: '基本信息',
                    requireAuth: true
                },
                component: Graduates
            },
            {
                path: '/graduatesDesign',
                name: 'GraDesign',
                meta: {
                    title: '毕业设计',
                    requireAuth: true
                },
                component: GraDesign
            }
            ,
            {
                path: '/employment',
                name: 'Employment',
                meta: {
                    title: '就业信息',
                    requireAuth: true
                },
                component: Employment
            },
            {
                path: '/archives',
                name: 'Archives',
                meta: {
                    title: '档案信息',
                    requireAuth: true
                },
                component: Archives
            },
            {
                path: '/grades',
                name: 'Grades',
                meta: {
                    title: '各科成绩',
                    requireAuth: true
                },
                component: Grades
            },
        ]
    }

]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
